package Exeption;

public class Test2 {

    public static void func2() throws StackOverflowError{
        func2();
    }
    public static void main(String[] args) {

        try {
            func2();
        } catch (StackOverflowError e) {
            e.printStackTrace();
            System.out.println("栈溢出");
        }
    }
}
